.image-selector {
	position: relative;
}

.image-selector__images {
	@include breakpoint( '>960px' ) {
		width: 250px;
	}

	@include breakpoint( '>1040px' ) {
		width: 338px;
	}
}

.image-selector__images-featured {
	position: relative;
	display: inline-block;
	vertical-align: top;
	width: 100%;
	max-width: 100%;
	margin-bottom: 16px;
}

.image-selector__item {
	position: relative;
	display: inline-block;
	margin: 0;

	figure {
		border: 1px solid var( --color-neutral-0 );
		position: relative;
	}

	img {
		display: block;
		width: 100%;
		height: auto;
		max-width: none;
	}
}

.image-selector__item.is-transient .image-selector__image::after {
	content: '';
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	background-color: rgba( var( --color-surface-rgb ), 0.75 );
	z-index: z-index( 'root', '.image-selector__item.is-transient::after' );
}

.image-selector__item .spinner {
	display: none;
}

.image-selector__item.is-transient .spinner {
	display: block;
	z-index: z-index( 'root', '.image-selector__item .spinner' );
}

.image-selector__item .spinner {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate( -50%, -50% );
}

.image-selector__images-thumbs {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	width: 100%;

	@include breakpoint( '>960px' ) {
		justify-content: flex-start;
	}
}

.button.is-borderless.image-selector__image {
	padding: 0;
}

.image-selector__images-thumbs .image-selector__item {
	position: relative;
	display: inline-block;
	margin-bottom: 16px;
	margin-right: 8px;
	margin-left: 8px;

	@include breakpoint( '>960px' ) {
		margin-left: 0;
		margin-right: 16px;
	}

	&:nth-child( 3n ) {
		@include breakpoint( '>960px' ) {
			margin-right: 0;
			clear: both;
		}
	}

	figure {
		width: 70px;
		height: 70px;
		overflow: hidden;

		@include breakpoint( '>1040px' ) {
			width: 100px;
			height: 100px;
		}
	}

	img {
		position: absolute;
		left: 50%;
		top: 50%;
		height: 100%;
		width: auto;
		transform: translate( -50%, -50% );
	}
}

.button.is-borderless.is-compact .image-selector__edit-icon {
	position: absolute;
	top: auto;
	bottom: 8px;
	right: 8px;
	padding: 0;
	color: var( --color-text-inverted );
	opacity: 0.9;
	background: #cccccc;
	border-radius: 50%;
}

.button .image-selector__edit:hover .image-selector__edit-icon {
	opacity: 1;
}

.image-selector__remove.button.is-compact {
	position: absolute;
	top: 0;
	right: 0;
	width: 28px;
	height: 28px;
	transform: translate( 25%, -25% );
	border: 1px solid var( --color-neutral-20 );
	border-radius: 50%;
	background-color: var( --color-neutral-0 );
	cursor: pointer;

	&:hover {
		background: var( --color-neutral-0 );
	}
}

.image-selector__remove .image-selector__remove-icon.gridicon {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate( -50%, -50% );
	width: 24px;
	height: 24px;
	margin: 0;
	color: var( --color-neutral-20 );

	&:hover {
	color: var( --color-neutral-light );
	}
}

.button.is-borderless.image-selector__uploader-wrapper {
	background: var( --color-neutral-0 );
	height: 250px;
	width: 100%;
	position: relative;
	margin-bottom: 16px;
	border: 1px dashed var( --color-neutral-light );
	border-radius: 5px;

	@include breakpoint( '>1040px' ) {
		height: 338px;
	}

	.image-selector__uploader-picker {
		position: absolute;
		top: 0;
		left: 0;
		height: 100%;
		width: 100%;
		text-align: center;
		cursor: pointer;
		display: flex;
		align-items: center;

		.gridicon {
			color: var( --color-neutral-40 );
		}

		p {
			font-size: 14px;
			margin-top: 12px;
			margin-bottom: 0;
		}

		&:hover {
			.gridicon {
				color: var( --color-neutral-60 );
			}
		}
	}
}

.button.is-borderless.image-selector__uploader-wrapper .image-selector__uploader-label {
	width: 100%;
	height: 100%;
	display: flex;
	justify-content: center;
	flex-direction: column;

	.gridicon {
		margin: 0;
		height: auto;
		width: auto;
	}
}

.button.is-borderless.image-selector__uploader-wrapper.compact {
	position: relative;
	margin-bottom: 16px;
	margin-left: 8px;
	margin-right: 8px;
	background: var( --color-neutral-0 );
	border: 1px dashed var( --color-neutral-light );
	width: 70px;
	height: 70px;
	border-radius: 5px;
	display: inline-block;

	@include breakpoint( '>960px' ) {
		margin-left: 0;
		margin-right: 16px;
	}

	@include breakpoint( '>1040px' ) {
		width: 100px;
		height: 100px;
	}

	&:nth-child( 3n ) {
		@include breakpoint( '>960px' ) {
			margin-right: 0;
		}
	}

	.image-selector__uploader-picker {
		display: block;
		text-align: center;
		cursor: pointer;
		position: absolute;
		top: 0;
		left: 0;
		width: 100%;
		height: 100%;

		@include breakpoint( '>960px' ) {
			height: 72px;
		}

		@include breakpoint( '>1040px' ) {
			height: 100px;
		}

		.gridicon {
			position: absolute;
			top: 50%;
			left: 50%;
			transform: translate( -50%, -50% );
			color: var( --color-neutral-40 );
		}
	}

	&:hover {
		.gridicon {
			color: var( --color-neutral-60 );
		}
	}
}
